package com.example.redis.zhenghe;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

/**
 * @Author:郭
 * @Description: TODO
 * @Date: 2022/12/23 10:54
 * @ClassName RedisTestController
 */
@RestController
@RequestMapping("/redis")
public class RedisTestController {
    @Autowired
    private RedisTemplate redisTemplate;
    @GetMapping("/add")
    public Object testRedis(){
        System.out.println("redis add");
        Set<String> keys = redisTemplate.keys("*");
        keys.forEach(k ->{
            System.out.println(k);
        });
        return "OK";
    }
}
